﻿using System;
using UnityEngine;

namespace UFrame
{
    public class OULerp : MonoBehaviour
    {
        public Transform target;
        public float speed = 0.1f;
        public bool isActive = false;
        public bool isRotation = false;
        public void Update()
        {
            if (target == null)
                return;
            
            if(!isActive)
                return;
            
            transform.position = Vector3.Lerp(transform.position, target.position, speed * Time.deltaTime);
            if (isRotation)
            {
                transform.rotation = Quaternion.Lerp(transform.rotation,target.rotation,speed * Time.deltaTime);
            }
        }
    }
}